<%@page import="org.soenea.doitall.domain.model.person.Person"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Browse People</title>
</head>
<body>
<h2>Browse People</h2>
<ul>
  <c:if test="${!empty warning}"> <b>Warning: </b> ${warning}<br/>
  </c:if>
  <c:forEach items="${people}" var="person">
    <%-- We could use "${pageContext.request.contextPath}/app/..." as part of the href. --%>
    <li>
      <form action="buddy/${person.id}" method="post" id="delete${person.id}">
        <div> <a href="buddy/${person.id}">${person.userName}</a>
          <input name="command" type="hidden" value="DeletePerson"/>
          <input type="submit" name="button" id="button" value="Delete"/>
        </div>
      </form>
    </li>
  </c:forEach>
</ul>
<!-- 
<h3>Modify a person:</h3>
<form id="ModifyPersonForm" name="ModifyPersonForm" method="post" action="">
<fieldset>
	<legend>Person Information</legend>
 	<div><label>Name:<input type="text" name="name" id="name" /></label></div>
 	<div><label>Age: <input type="text" name="age" id="age" /></label></div>
 	<div><label>Buddy: <input type="text" name="buddy" id="buddy" /></label></div>
 	<input type="submit" name="submit" id="submit" value="Add" />
    <input name="version" type="hidden" value="${person.version}"/>
 	<input name="command" type="hidden" value="ModifyPerson" />    
</fieldset>
</form>
 -->
<h3>Add a person:</h3>
<form id="AddPersonForm" method="post" action="">
  <fieldset>
    <legend>Person Information</legend>
    <div>
      <label>Username:
        <input type="text" name="username" id="username" />
      </label>
    </div>
    <div>
      <label>Password:
        <input type="text" name="password" id="password" />
      </label>
    </div>
    <div>
      <label>First name:
        <input type="text" name="firstName" id="firstName" />
      </label>
    </div>
    <div>
      <label>Last name:
        <input type="text" name="lastName" id="lastName" />
      </label>
    </div>
    <input type="submit" name="submit" id="submit" value="Add" />
    <input name="command" type="hidden" value="AddPerson" />
  </fieldset>
</form>
<p> Return to <a href="../login">main page</a> </p>
</body>
</html>